package com.sairobo.live.api;

import com.sairobo.live.api.hystrix.UserFeignClientHystrixFallback;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * Function:
 *
 * @author crossoverJie
 *         Date: 2017/7/16 19:48
 * @since JDK 1.8
 */
@RestController
@Api("用户服务API")
@RequestMapping(value = "/userService")
@Validated
@FeignClient(name="user-test",fallback = UserFeignClientHystrixFallback.class)
//@FeignClient(name="user-test")
public interface UserService {


    /**
     * 获取用户
     * @return
     */
    @ApiOperation("获取用户")
    @RequestMapping(value = "/getOrderNo", method = RequestMethod.POST)
    void getOrderNo() ;

    /**
     * 通过Feign获取用户
     * @return
     */
    @ApiOperation("通过Feign获取用户")
    @RequestMapping(value = "/getUserByFeign", method = RequestMethod.POST)
    void getUserByFeign() ;


    /**
     * 批量请求接口
     * @return
     */
    @ApiOperation("批量请求接口")
    @RequestMapping(value = "/getUserByFeignBatch", method = RequestMethod.POST)
    void getUserByFeignBatch() ;

    /**
     * hystrix容错调用
     * @return
     */
    @ApiOperation("hystrix容错调用")
    @RequestMapping(value = "/getUserByHystrix", method = RequestMethod.POST)
    String getUserByHystrix() ;
}
